﻿using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using NXDO.Data.Factory;
using NXDO.WebAPI.Controllers;
using System.Data;

namespace TDM.WebSvr.Controllers.Security
{
    /// <summary>
    /// 用户查询
    /// </summary>
    [AllowAnonymous]
    public class UserQueryController : ApiDbController
    {
        /// <summary>
        /// 获取所有用户的id和name
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public DataTable QueryUsers()
        {
            try
            {
                string sqltxt = "select userid,realname from dauser";
                var rs = DbHelper.SetCommand(sqltxt).ExecuteDataTable();
                if (rs.Rows.Count > 0) return rs;
                else return null;
            }
            catch (System.Exception)
            {

                throw;
            }
        }
    }
}
